<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>

<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>주소/우편번호 검색</title>
<link href="./css/css.css" rel="stylesheet" type="text/css">
<script language="JavaScript">
	function dongCheck(){
		if(document.zipForm.dongri.value==""){
			alert("동이름을 입력하세요");
			document.zipForm.dongri.focus();
			return;
		}
		document.zipForm.submit();
	}
	function sendAddress(zipcode,sido,gugun,dongri,bunji){
		var address = sido+" "+gugun+" "+dongri+" "+bunji;
		opener.document.memberInsert.zipcode.value=zipcode;
		opener.document.memberInsert.address1.value=address;
		opener.document.memberInsert.address2.focus();
		self.close();
	}
</script>
</head>
 <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onload="zipForm.text.focus()">
 	<form name="zipForm" method="post" action="zipcodeCheck.action">
    <table width="100%" border="0" cellpadding="0" cellspacing="0" class="BTABLE">

	    <tr>
        <td height="30">&nbsp; 
        <font class="BFONT2"><b>우편번호 검색</b></font></td>
    </tr>
    <tr><td height="40"></td></tr>
    <tr>
        <td align="center">
            동이름 입력: <input type="text" name="dongri"  size="20" maxlength="30">
            <input type="button" value="검 색" onclick="dongCheck();">
            <input type="hidden" name="check" value="n">
        </td>
    </tr>
    
    <tr><td height="30"></td></tr>
    <tr class="d">
   		<td height="40" align="center">
          	<b>동</b> 으로 검색해 주세요.<br>
            <font color="#0000FF">(예: 암사2동/신월1동/송파동)</font>
        </td>
    </tr>
    </form>
	<s:if test="zipcodeList==null">
  <tr><td align="center"><br>검색된 결과가 없습니다.</td></tr>
</s:if>
<s:else>
     <tr class="BTD">
        <td align="center">
        	검색결과가 나오면 맞는 부분을 클릭하시면 <br>
        	자동으로 주소와 우편번호란에 채워집니다
        </td>
        
   <s:iterator value="zipcodeList" status="stat">
     <c:forEach var="i" begin="zipcodeList.size" end="0">
	  <tr><td>
	  <a href="javascript:sendAddress(
	  '<s:property value="zipcode"/>',
	  '<s:property value="sido"/>',
	  '<s:property value="gugun"/>',
	  '<s:property value="dongri"/>',
	  '<s:property value="bunji"/>')">
	  
	  <s:property value="zipcode"/>&nbsp;
	  <s:property value="sido"/>&nbsp;
	  <s:property value="gugun"/>&nbsp;
	  <s:property value="dongri"/>&nbsp;
	  <s:property value="bunji"/></a>
	  <br>
	  </td>
	  </tr>
	  </c:forEach>
</s:iterator>
		
</s:else>


<tr><td align="center"><br><a href="javascript:this.close();">닫기</a><tr></td>


</table>

</center>
</body>


</html>
